package com.sg.service.biz.bff.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.dto.TreeNode;
import com.sg.common.exception.Assert;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.ExportCallBack;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.bff.common.BffEvaObjTargetCycleDto;
import com.sg.dto.biz.bff.req.BffImplementBrushTempTargetContTreeOrderNumReqDto;
import com.sg.dto.biz.bff.req.BffQueryPlanningDataExportDetailListReqDto;
import com.sg.dto.biz.bff.req.BffQueryTargetContCrumbsListReqDto;
import com.sg.dto.biz.bff.req.BffQueryTargetCycleAncestorDataOriginListReqDto;
import com.sg.dto.biz.bff.res.BffImplementBrushTempTargetContTreeOrderNumRespDto;
import com.sg.dto.biz.bff.res.BffQueryPlanningDataExportDetailListRespDto;
import com.sg.dto.biz.bff.res.BffQueryTargetContCrumbsListRespDto;
import com.sg.dto.biz.bff.res.BffQueryTargetCycleAncestorDataOriginListRespDto;
import com.sg.dto.integration.app.*;
import com.sg.dto.integration.component.*;
import com.sg.dto.integration.component.QueryConfItemMatchAnswerListComReqDto;
import com.sg.service.biz.bff.TargetContComService;
import com.wicket.okrapp.integration.EvaThemeService;
import com.wicket.okrapp.integration.TargetContComService;
import com.wicket.okrcomponent.integration.ConfSchemeService;
import com.wicket.okrcomponent.integration.InterfaceModeService;
import com.wicket.okrcomponent.integration.TemplateEngineService;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class TargetContComServiceImpl implements TargetContComService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    com.sg.service.biz.app.TargetContComService fwAppTargetContComClient;
    @Resource
    com.sg.service.biz.app.EvaThemeService fwAppEvaThemeClient;

    @Resource
    com.sg.service.biz.component.InterfaceModeService fwCompInterfaceModeClient;

    @Resource
    com.sg.service.biz.component.TemplateEngineService fwCompTemplateEngineClient;

    @Resource
    com.sg.service.biz.component.ConfSchemeService fwCompConfSchemeClient;

    /**
     * B3执行刷全模板目标内容树排序(管理)[9598]
     * gen by moon at 5/17/2024, 2:40:27 AM
     */
    @Trace(operationName = "B3执行刷全模板目标内容树排序(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementBrushTempTargetContTreeOrderNumRespDto implementBrushTempTargetContTreeOrderNum(BffImplementBrushTempTargetContTreeOrderNumReqDto reqDto) {


        //步骤0: D3执行刷全模板目标内容树排序 - implementBrushTempTargetContTreeOrderNum
        ImplementBrushTempTargetContTreeOrderNumRespDto implementBrushTempTargetContTreeOrderNumRespDto = null;
        ImplementBrushTempTargetContTreeOrderNumReqDto implementBrushTempTargetContTreeOrderNumReqDto = new ImplementBrushTempTargetContTreeOrderNumReqDto();
        implementBrushTempTargetContTreeOrderNumReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1805655_1
        if (reqDto != null) {
            implementBrushTempTargetContTreeOrderNumReqDto.setEvaObjEntityId(reqDto.getEvaObjEntityId());//SimpleFieldAssign//sourceId:1805652_1
            implementBrushTempTargetContTreeOrderNumReqDto.setEvaObjTypeCode(reqDto.getEvaObjTypeCode());//SimpleFieldAssign//sourceId:1805653_1
            implementBrushTempTargetContTreeOrderNumReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1805654_1
        }

        /*D3执行刷全模板目标内容树排序[9592]   */
        Assert.isNull(implementBrushTempTargetContTreeOrderNumReqDto.getEvaObjEntityId(), "B3执行刷全模板目标内容树排序(管理)-D3执行刷全模板目标内容树排序-被评对象内容表主键ID不能为空", false);
        Assert.isNull(implementBrushTempTargetContTreeOrderNumReqDto.getEvaObjTypeCode(), "B3执行刷全模板目标内容树排序(管理)-D3执行刷全模板目标内容树排序-被评对象类型编码不能为空", false);
        Assert.isNull(implementBrushTempTargetContTreeOrderNumReqDto.getEvaluationTemplateId(), "B3执行刷全模板目标内容树排序(管理)-D3执行刷全模板目标内容树排序-冗余评价模板ID不能为空", false);
        Assert.isNull(implementBrushTempTargetContTreeOrderNumReqDto.getSpaceId(), "B3执行刷全模板目标内容树排序(管理)-D3执行刷全模板目标内容树排序-创建于空间ID不能为空", false);
        implementBrushTempTargetContTreeOrderNumRespDto = fwAppTargetContComClient.implementBrushTempTargetContTreeOrderNum(implementBrushTempTargetContTreeOrderNumReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        BffImplementBrushTempTargetContTreeOrderNumRespDto retData = new BffImplementBrushTempTargetContTreeOrderNumRespDto();


        return retData;
    }

    /**
     * B3查询目标周期祖先数据源列表[9590]
     * gen by moon at 5/17/2024, 3:09:59 AM
     */
    @Trace(operationName = "B3查询目标周期祖先数据源列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTargetCycleAncestorDataOriginListRespDto queryTargetCycleAncestorDataOriginList(BffQueryTargetCycleAncestorDataOriginListReqDto reqDto) {


        QueryTargetCycleAncestorDataOriginListRespDto queryTargetCycleAncestorDataOriginListRespDto_1 = null;
//步骤0: D3查询目标周期祖先数据源列表 - queryTargetCycleAncestorDataOriginList
        QueryTargetCycleAncestorDataOriginListRespDto queryTargetCycleAncestorDataOriginListRespDto = null;
        QueryTargetCycleAncestorDataOriginListReqDto queryTargetCycleAncestorDataOriginListReqDto = new QueryTargetCycleAncestorDataOriginListReqDto();
        queryTargetCycleAncestorDataOriginListReqDto.setEvaObjEntityId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1803903_1
        queryTargetCycleAncestorDataOriginListReqDto.setEvaObjTypeCode("EVA_OBJECT");//sourceId:1803904_1
        if (reqDto != null) {
            queryTargetCycleAncestorDataOriginListReqDto.setEvaObjTargetCycleCode(reqDto.getEvaObjTargetCycleCode());//SimpleFieldAssign//sourceId:1803902_1
            queryTargetCycleAncestorDataOriginListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1803905_1
        }

        /*D3查询目标周期祖先数据源列表[9588]   */
        Assert.isNull(queryTargetCycleAncestorDataOriginListReqDto.getEvaObjTargetCycleCode(), "B3查询目标周期祖先数据源列表-D3查询目标周期祖先数据源列表-被评对象目标周期标识不能为空", false);
        Assert.isNull(queryTargetCycleAncestorDataOriginListReqDto.getEvaObjEntityId(), "B3查询目标周期祖先数据源列表-D3查询目标周期祖先数据源列表-被评对象内容表主键ID不能为空", false);
        Assert.isNull(queryTargetCycleAncestorDataOriginListReqDto.getEvaObjTypeCode(), "B3查询目标周期祖先数据源列表-D3查询目标周期祖先数据源列表-被评对象类型编码不能为空", false);
        Assert.isNull(queryTargetCycleAncestorDataOriginListReqDto.getEvaluationTemplateId(), "B3查询目标周期祖先数据源列表-D3查询目标周期祖先数据源列表-冗余评价模板ID不能为空", false);
        queryTargetCycleAncestorDataOriginListRespDto = fwAppTargetContComClient.queryTargetCycleAncestorDataOriginList(queryTargetCycleAncestorDataOriginListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryTargetCycleAncestorDataOriginListRespDto_1 = queryTargetCycleAncestorDataOriginListRespDto;

        BffQueryTargetCycleAncestorDataOriginListRespDto retData = new BffQueryTargetCycleAncestorDataOriginListRespDto();
        if (queryTargetCycleAncestorDataOriginListRespDto_1 != null) {
            retData.setEvaObjTargetCycleList(queryTargetCycleAncestorDataOriginListRespDto_1.getEvaObjTargetCycleList().stream().map(item -> BeanUtil.toBean(item, BffEvaObjTargetCycleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1803909_1
        }


        return retData;
    }

    /**
     * B3查询目标内容面包屑列表[10089]
     * gen by moon at 8/9/2024, 4:05:20 PM
     */
    @Trace(operationName = "B3查询目标内容面包屑列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTargetContCrumbsListRespDto queryTargetContCrumbsList(BffQueryTargetContCrumbsListReqDto reqDto) {


        QueryTargetContCrumbsListRespDto queryTargetContCrumbsListRespDto_1 = null;
//步骤0: D3查询目标内容面包屑列表 - queryTargetContCrumbsList
        QueryTargetContCrumbsListRespDto queryTargetContCrumbsListRespDto = null;
        QueryTargetContCrumbsListReqDto queryTargetContCrumbsListReqDto = new QueryTargetContCrumbsListReqDto();
        if (reqDto != null) {
            queryTargetContCrumbsListReqDto.setEvaObjTargetCycleId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:1966804_1
            queryTargetContCrumbsListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1966805_1
        }

        /*D3查询目标内容面包屑列表[10088]   */
        Assert.isNull(queryTargetContCrumbsListReqDto.getEvaObjTargetCycleId(), "B3查询目标内容面包屑列表-D3查询目标内容面包屑列表-被评对象目标周期ID不能为空", false);
        Assert.isNull(queryTargetContCrumbsListReqDto.getEvaluationTemplateId(), "B3查询目标内容面包屑列表-D3查询目标内容面包屑列表-冗余评价模板ID不能为空", false);
        queryTargetContCrumbsListRespDto = fwAppTargetContComClient.queryTargetContCrumbsList(queryTargetContCrumbsListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryTargetContCrumbsListRespDto_1 = queryTargetContCrumbsListRespDto;

        BffQueryTargetContCrumbsListRespDto retData = new BffQueryTargetContCrumbsListRespDto();
        if (queryTargetContCrumbsListRespDto_1 != null) {
            retData.setEvaObjTargetCycleList(queryTargetContCrumbsListRespDto_1.getEvaObjTargetCycleList().stream().map(item -> BeanUtil.toBean(item, BffEvaObjTargetCycleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1966809_1
        }


        List<Object> allNodes = new ArrayList<>();
        allNodes.addAll(retData.getEvaObjTargetCycleList());
        List<TreeNode> nodeList = CommonFunctionHelper.buildTree(allNodes);
        retData.setTreeNode(nodeList);
        retData.setEvaObjTargetCycleList(null);

        return retData;
    }

    /**
     * B3查询规划数据导出内容明细列表[10481]
     * gen by moon at 1/1/2025, 5:57:38 PM
     */
    @Trace(operationName = "B3查询规划数据导出内容明细列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryPlanningDataExportDetailListRespDto queryPlanningDataExportDetailList(BffQueryPlanningDataExportDetailListReqDto reqDto, ExportCallBack exportCallBack) {


        //virtualUsage D3查询规划数据导出内容明细列表(公共)  73855
        QueryPlanningDataExportDetailListComRespDto queryPlanningDataExportDetailListComRespDto = null;
        QueryPlanningDataExportDetailListComReqDto queryPlanningDataExportDetailListComReqDto = new QueryPlanningDataExportDetailListComReqDto();
        if (reqDto != null) {
            queryPlanningDataExportDetailListComReqDto.setLevelNumber(reqDto.getLevelNumber());//SimpleFieldAssign//sourceId:2039222_1_73855
            queryPlanningDataExportDetailListComReqDto.setIsLastObjective(reqDto.getIsLastObjective());//SimpleFieldAssign//sourceId:2038998_1_73855
            queryPlanningDataExportDetailListComReqDto.setCycleId(reqDto.getCycleId());//SimpleFieldAssign//sourceId:2038999_1_73855
            queryPlanningDataExportDetailListComReqDto.setParentSubMidCycleType(reqDto.getParentSubMidCycleType());//SimpleFieldAssign//sourceId:2039000_1_73855
            queryPlanningDataExportDetailListComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:2039001_1_73855
        }

        /*D3查询规划数据导出内容明细列表(公共)[10480]   */
        Assert.isNull(queryPlanningDataExportDetailListComReqDto.getCycleId(), "B3查询规划数据导出内容明细列表-D3查询规划数据导出内容明细列表(公共)-归属周期ID不能为空", false);
        Assert.isNull(queryPlanningDataExportDetailListComReqDto.getParentSubMidCycleType(), "B3查询规划数据导出内容明细列表-D3查询规划数据导出内容明细列表(公共)-父子中周期类型不能为空", false);
        Assert.isNull(queryPlanningDataExportDetailListComReqDto.getEvaluationTemplateId(), "B3查询规划数据导出内容明细列表-D3查询规划数据导出内容明细列表(公共)-冗余评价模板ID不能为空", false);
        queryPlanningDataExportDetailListComRespDto = fwAppTargetContComClient.queryPlanningDataExportDetailListCom(queryPlanningDataExportDetailListComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        if ((queryPlanningDataExportDetailListComRespDto != null && queryPlanningDataExportDetailListComRespDto.getPlanningExportDetailList() != null && queryPlanningDataExportDetailListComRespDto.getPlanningExportDetailList().size() > 0)) {
            //if(D3查询规划数据导出内容明细列表(公共).规划数据导出明细列表数据集条数 大于 0)  73856

            QueryEvaTempDetailComRespDto queryEvaTempDetailComRespDto = null;
            QueryEvaTempDetailComReqDto queryEvaTempDetailComReqDto = new QueryEvaTempDetailComReqDto();
            queryEvaTempDetailComReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:2039044_1_73857
            if (reqDto != null) {
                queryEvaTempDetailComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:2039043_1_73857
            }

            /*D3查询评价模板详情(公共)[8468]   */
            Assert.isNull(queryEvaTempDetailComReqDto.getEvaluationTemplateId(), "B3查询规划数据导出内容明细列表-D3查询评价模板详情(公共)-评价模板ID不能为空", false);
            Assert.isNull(queryEvaTempDetailComReqDto.getSubjectLifeCycle(), "B3查询规划数据导出内容明细列表-D3查询评价模板详情(公共)-主体生命周期不能为空", false);
            queryEvaTempDetailComRespDto = fwAppEvaThemeClient.queryEvaTempDetailCom(queryEvaTempDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            ImplementTimeTurnToStringComRespDto implementTimeTurnToStringComRespDto = null;
            ImplementTimeTurnToStringComReqDto implementTimeTurnToStringComReqDto = new ImplementTimeTurnToStringComReqDto();
            implementTimeTurnToStringComReqDto.setComTimeField(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:2039014_1_73858

            /*D2-执行标准时间转换为字符串(公共)[6274]   */
            Assert.isNull(implementTimeTurnToStringComReqDto.getComTimeField(), "B3查询规划数据导出内容明细列表-D2-执行标准时间转换为字符串(公共)-通用时间字段不能为空", false);
            implementTimeTurnToStringComRespDto = fwCompInterfaceModeClient.implementTimeTurnToStringCom(implementTimeTurnToStringComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            GenerateSemanticInstanceStoryComRespDto generateSemanticInstanceStoryComRespDto = null;
            if (queryEvaTempDetailComRespDto != null && implementTimeTurnToStringComRespDto != null) {
                GenerateSemanticInstanceStoryComReqDto generateSemanticInstanceStoryComReqDto = new GenerateSemanticInstanceStoryComReqDto();
                generateSemanticInstanceStoryComReqDto.setTemplateSemanticEngineCode("HIGH_LEVEL_EXPORT_PLANNING_DATA_FILE_NAMING");//CUSTOM_CONVENTION//sourceId:2039022_1_73859
                generateSemanticInstanceStoryComReqDto.setFirstFieldName("evaluationTempName");//CUSTOM_CONVENTION//sourceId:2039016_1_73859
                generateSemanticInstanceStoryComReqDto.setSecondFieldName("comTxtField");//CUSTOM_CONVENTION//sourceId:2039018_1_73859
                if (queryEvaTempDetailComRespDto != null) {
                    generateSemanticInstanceStoryComReqDto.setFirstFieldValue(queryEvaTempDetailComRespDto.getEvaluationTempName());//SimpleFieldAssign//sourceId:2039017_1_73859
                }
                if (implementTimeTurnToStringComRespDto != null) {
                    generateSemanticInstanceStoryComReqDto.setSecondFieldValue(implementTimeTurnToStringComRespDto.getComTxtField());//SimpleFieldAssign//sourceId:2039019_1_73859
                }

                /*D2生成语义实例故事（生成导出文件名）[8234]   */
                Assert.isNull(generateSemanticInstanceStoryComReqDto.getTemplateSemanticEngineCode(), "B3查询规划数据导出内容明细列表-D2生成语义实例故事（生成导出文件名）-模板引擎标识不能为空", false);
                Assert.isNull(generateSemanticInstanceStoryComReqDto.getFirstFieldName(), "B3查询规划数据导出内容明细列表-D2生成语义实例故事（生成导出文件名）-第一个字段字段名不能为空", false);
                Assert.isNull(generateSemanticInstanceStoryComReqDto.getFirstFieldValue(), "B3查询规划数据导出内容明细列表-D2生成语义实例故事（生成导出文件名）-第一个字段字段值不能为空", false);
                Assert.isNull(generateSemanticInstanceStoryComReqDto.getSecondFieldName(), "B3查询规划数据导出内容明细列表-D2生成语义实例故事（生成导出文件名）-第二个字段字段名不能为空", false);
                Assert.isNull(generateSemanticInstanceStoryComReqDto.getSecondFieldValue(), "B3查询规划数据导出内容明细列表-D2生成语义实例故事（生成导出文件名）-第二个字段字段值不能为空", false);
                generateSemanticInstanceStoryComRespDto = fwCompTemplateEngineClient.generateSemanticInstanceStoryCom(generateSemanticInstanceStoryComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            }
            QueryConfItemMatchAnswerListComRespDto queryConfItemMatchAnswerListComRespDto = null;
            if (queryEvaTempDetailComRespDto != null) {
                QueryConfItemMatchAnswerListComReqDto queryConfItemMatchAnswerListComReqDto = new QueryConfItemMatchAnswerListComReqDto();
                queryConfItemMatchAnswerListComReqDto.setConfItemCode("HIGH_LEVEL_PLANNING_DATA_EXPORT_FIELD_RANGE");//CUSTOM_CONVENTION//sourceId:2039031_1_73860
                queryConfItemMatchAnswerListComReqDto.setResultAspObjType("EVA_THEME");//sourceId:2039050_1_73860
                queryConfItemMatchAnswerListComReqDto.setIsPlatData("FALSE");//sourceId:2039034_1_73860
                if (queryEvaTempDetailComRespDto != null) {
                    queryConfItemMatchAnswerListComReqDto.setResultAspObjId(queryEvaTempDetailComRespDto.getEvaluationSubjectId());//SimpleFieldAssign//sourceId:2039033_1_73860
                }

                /*D2-3查配置项匹配答案列表(公共)（跨服务）[2505]   */
                Assert.isNull(queryConfItemMatchAnswerListComReqDto.getConfItemCode(), "B3查询规划数据导出内容明细列表-D2-3查配置项匹配答案列表(公共)（跨服务）-配置项标识不能为空", false);
                Assert.isNull(queryConfItemMatchAnswerListComReqDto.getResultAspObjId(), "B3查询规划数据导出内容明细列表-D2-3查配置项匹配答案列表(公共)（跨服务）-开通对象ID不能为空", false);
                Assert.isNull(queryConfItemMatchAnswerListComReqDto.getResultAspObjType(), "B3查询规划数据导出内容明细列表-D2-3查配置项匹配答案列表(公共)（跨服务）-开通对象类型编码不能为空", false);
                Assert.isNull(queryConfItemMatchAnswerListComReqDto.getIsPlatData(), "B3查询规划数据导出内容明细列表-D2-3查配置项匹配答案列表(公共)（跨服务）-是否标准答案不能为空", false);
                queryConfItemMatchAnswerListComRespDto = fwCompConfSchemeClient.queryConfItemMatchAnswerListCom(queryConfItemMatchAnswerListComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            }
            ImplementExportDatatoExcelComRespDto implementExportDatatoExcelComRespDto = null;
            if (generateSemanticInstanceStoryComRespDto != null && queryConfItemMatchAnswerListComRespDto != null && queryPlanningDataExportDetailListComRespDto != null) {
                ImplementExportDatatoExcelComReqDto implementExportDatatoExcelComReqDto = new ImplementExportDatatoExcelComReqDto();
                implementExportDatatoExcelComReqDto.setExportFileFormat("XLSX");//sourceId:2039042_1_73861
                if (generateSemanticInstanceStoryComRespDto != null) {
                    implementExportDatatoExcelComReqDto.setExportExcelFileName(generateSemanticInstanceStoryComRespDto.getObjectName());//SimpleFieldAssign//sourceId:2039041_1_73861
                }
                if (queryConfItemMatchAnswerListComRespDto != null && queryConfItemMatchAnswerListComRespDto.getConfSchemeItemResultList() != null && !CollectionUtil.isEmpty(queryConfItemMatchAnswerListComRespDto.getConfSchemeItemResultList())) {
                    implementExportDatatoExcelComReqDto.setExcelHeaderFieldDataList(//objList-to-objLists
                            queryConfItemMatchAnswerListComRespDto.getConfSchemeItemResultList().stream().map(item -> {
                                ExcelHeaderFieldDataDto elm = new ExcelHeaderFieldDataDto();
                                if (item != null) {
                                    elm.setExcelHeaderEnFields(item.getEndValue());//SimpleFieldAssign//sourceId:431593_2_73861
                                    elm.setExcelHeaderCnFields(item.getExtensionField1());//SimpleFieldAssign//sourceId:431594_2_73861
                                    elm.setExcelHeaderFieldSorting(item.getExtensionField2() != null ? Long.valueOf(item.getExtensionField2()) : null);//SimpleFieldAssign//sourceId:431592_2_73861
                                }
                                return elm;
                            }).collect(Collectors.toList()));//objList-to-objLists//sourceId:2039039_1_73861
                }
                if (queryPlanningDataExportDetailListComRespDto != null && queryPlanningDataExportDetailListComRespDto.getPlanningExportDetailList() != null && !CollectionUtil.isEmpty(queryPlanningDataExportDetailListComRespDto.getPlanningExportDetailList())) {
                    implementExportDatatoExcelComReqDto.setExportDataList(//objList-to-objLists
                            queryPlanningDataExportDetailListComRespDto.getPlanningExportDetailList().stream().map(item -> {
                                ExportDataDto elm = new ExportDataDto();
                                if (item != null) {
                                    elm.setExportDataFields1(item.getEvaluationTempName());//SimpleFieldAssign//sourceId:431595_2_73861
                                    elm.setExportDataFields2(item.getRootTargetCategoryName() != null ? String.valueOf(item.getRootTargetCategoryName()) : "");//SimpleFieldAssign//sourceId:431596_2_73861
                                    elm.setExportDataFields3(item.getLastTargetCategoryName() != null ? String.valueOf(item.getLastTargetCategoryName()) : "");//SimpleFieldAssign//sourceId:431597_2_73861
                                    elm.setExportDataFields4(item.getObjectiveShortName());//SimpleFieldAssign//sourceId:431598_2_73861
                                    elm.setExportDataFields5(item.getDeptShortName());//SimpleFieldAssign//sourceId:431599_2_73861
                                    elm.setExportDataFields6(item.getPersonLiableIdCardName() != null ? String.valueOf(item.getPersonLiableIdCardName()) : "");//SimpleFieldAssign//sourceId:431600_2_73861
                                    elm.setExportDataFields7(item.getDirectorIdCardName() != null ? String.valueOf(item.getDirectorIdCardName()) : "");//SimpleFieldAssign//sourceId:431601_2_73861

                                    if (item.getShowTargetValue() != null) {
                                        if (CommonFunctionHelper.isDecimalPartAllZeros(item.getShowTargetValue())) {
                                            elm.setExportDataFields8(item.getShowTargetValue().intValue() + item.getUnit());//SimpleFieldAssign//sourceId:431602_2_73861
                                        } else {
                                            elm.setExportDataFields8(item.getShowTargetValue() + item.getUnit());//SimpleFieldAssign//sourceId:431602_2_73861
                                        }
                                    }

                                    if (item.getActualValue() != null) {
                                        if (CommonFunctionHelper.isDecimalPartAllZeros(item.getActualValue())) {
                                            elm.setExportDataFields9(item.getActualValue().intValue() + item.getActualValueUnit());
                                        } else {
                                            elm.setExportDataFields9(item.getActualValue() + item.getActualValueUnit());
                                        }
                                    }

                                    if (item.getProgressValue() != null) {
                                        if (CommonFunctionHelper.isDecimalPartAllZeros(item.getProgressValue())) {
                                            elm.setExportDataFields10(item.getProgressValue().intValue() + item.getProgressValueUnit());
                                        } else {
                                            elm.setExportDataFields10(item.getProgressValue() + item.getProgressValueUnit());
                                        }
                                    }


                                }
                                return elm;
                            }).collect(Collectors.toList()));//objList-to-objLists//sourceId:2039040_1_73861
                }

                /*D2执行数据导出excel(公共)[10476]   */
                Assert.isNull(implementExportDatatoExcelComReqDto.getExportExcelFileName(), "B3查询规划数据导出内容明细列表-D2执行数据导出excel(公共)-导出excel文件名不能为空", false);
                Assert.isNull(implementExportDatatoExcelComReqDto.getExportFileFormat(), "B3查询规划数据导出内容明细列表-D2执行数据导出excel(公共)-导出文件格式不能为空", false);
//      implementExportDatatoExcelComRespDto = fwCompInterfaceModeClient.implementExportDatatoExcelCom(implementExportDatatoExcelComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
                Map<String, Object> exportData = new HashMap<>();
                exportData.put("exportFileFormat", implementExportDatatoExcelComReqDto.getExportFileFormat());
                exportData.put("exportExcelFileName", implementExportDatatoExcelComReqDto.getExportExcelFileName());
                exportData.put("excelHeaderFieldDataList", implementExportDatatoExcelComReqDto.getExcelHeaderFieldDataList());
                exportData.put("exportDataList", implementExportDatatoExcelComReqDto.getExportDataList());
                exportCallBack.excute(exportData);


            }
        }
        BffQueryPlanningDataExportDetailListRespDto retData = new BffQueryPlanningDataExportDetailListRespDto();


        return retData;
    }
    //
}
